package com.example.film.service;

import com.example.film.entity.NewCinema;
import com.example.film.mapper.NewCinemaMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewCinemaServiceImpl implements NewCinemaService{

    @Autowired
    private NewCinemaMapper newCinemaMapper;

    @Override
    public List<NewCinema> findNewCinema() {
        return newCinemaMapper.findNewCinema();
    }

    @Override
    public List<NewCinema> findNewCinemaInfo(Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return newCinemaMapper.findNewCinemaInfo(startIndex,pageSize);
    }

    @Override
    public List<NewCinema> findNewCinemaByDate(Integer year, Integer month, Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return newCinemaMapper.findNewCinemaByDate(year, month, startIndex, pageSize);
    }
}
